

//引入mongoose数据库
const mongoose = require("mongoose");
//2.创建当前数据库的某个集合的约束对象 //mongoose.Schema()
const advSchema = new mongoose.Schema({
    advTitle: {
        type: String,
        required: true
    },
    advType: {
        type: String,
        required: true
    },
    advOrder: {
        type: String,
        required: true
    },
    advHref: {
        type: String,
        required: true,
        default:"----"
    },
    addTime:{
        type: String,
        required: true,
        default:new Date().toLocaleString
    },
    updateTime:{
        type: String,
        required: true,
        default:"--"
    }
});

//3.根据某个约束对象,去创建某个集合
const advModel = mongoose.model("advList", advSchema); //集合的名字 约束对象
//暴露
module.exports = advModel;